<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <script src="__STATIC__/js/base.js"></script>
    <title>服务商加盟</title>
    <link rel="stylesheet" href="__STATIC__/css/base.css">
    <link rel="stylesheet" href="__STATIC__/css/privider.css">
    <link rel="stylesheet" href="__STATIC__/js/layer_mobile/need/layer.css">
    <script src="__STATIC__/js/jquery-1.11.1.min.js"></script>
    <script src="__STATIC__/js/form_validation.js"></script>
    <script src="__STATIC__/js/layer_mobile/layer.js"></script>
</head>
<body>
<section class="wrap">
    <div  class="privider-img"> <img src="__STATIC__/images/privider.png"></div>
    <div  class="privider-produce">加盟我们后，您只需将能做的服务内容上架到平台，就
        可以实现全天接单不再受到地域的限制，让收入获得爆发式
        增长。我们为您解决广告费用高、获客难的痛点使得人人可
        成为平台服务商，自己做老板。</div>
    <div  class="privider-form">
        <form id="form1">
            {if condition="empty($Think.session.Login_userId)" }
            <div class="form-content ">
                <div class="clearfix input-inline">
                    <div class="formtitle pull-left">姓名：</div>
                    <div class="formcontent pull-left">
                        <input tabindex="1"  id="real_name" class="inputstyle1" autocomplete="off" type="text" name="username" placeholder="请输入姓名"/>
                        <span class="success"></span>
                    </div>
                </div>
            </div>
            <div class="form-content ">
                <div class="clearfix input-inline">
                    <div class="formtitle pull-left">手机号：</div>
                    <div class="formcontent pull-left">
                        <input tabindex="1"  id="phone_number" class="inputstyle1" autocomplete="off" type="text" name="mobile" placeholder="请输入手机号"/>
                        <span class="success"></span>
                    </div>
                </div>
            </div>
            <div class="form-content ">
                <div class="clearfix input-inline position-re">
                    <div class="formtitle pull-left">验证码：</div>
                    <div class="formcontent pull-left formcontent-capche">
                        <input tabindex="1"  id="code" class="inputstyle1 inputstyle1-capche" autocomplete="off" type="text" name="username" placeholder="请输入验证码"/>
                        <span class="success"></span>
                    </div>
                    <input type="button" class="position-capche"  value="发送验证码" id="verification_code"  onclick="sendCapche()">
                </div>
            </div>
            {/if}
            <div class="form-content ">
                <div class="clearfix input-inline">
                    <div class="formtitle pull-left">推荐码：</div>
                    <div class="formcontent pull-left">
                        <input tabindex="1"  id="" class="inputstyle1" autocomplete="off" type="text" name="invitationCode" placeholder="请输入推荐码"/>
                        <span class="success"></span>
                    </div>
                </div>
            </div>
            <div class="form-content ">
                <div class="clearfix input-inline">
                    <div class="formtitle pull-left">类别：</div>
                    <div class="formcontent pull-left" style="border:none;padding-top: 0.32rem">
                         <input type="radio"  name="companyType" value="1" class="radio"  checked="checked">个人用户
                       <input type="radio"  name="companyType" value="2" class="radio" style="margin-left: 1rem">公司用户
                    </div>
                </div>
            </div>
            <div class="privider-button-div" style="padding-bottom: 0.812rem">
            <input type="button" value="申请加盟" class="privider-button" id="sublimit">
           </div>
        </form>
    </div>
</section>
<script>
    function sendCapche(){
        var phone = $('#phone_number').val();
        if(phone ==''){
            layer.open({
                content:'请先填写手机号'
                ,skin: 'msg'
                ,time:3 //2秒后自动关闭
            });
            return false;
        }
        if(/^((13[0-9])|(14[7,9])|(15[^4,\D])|(17[^4,^9,\D])|(18[0-9]))\d{8}$/.test(phone)){
            var formData = {sms_code:"SMS_94520048",phone:phone};
            $.ajax({
                url : "{:\\think\\Url::build('index/Supplier/personalCheckMobile')}",
                type: "POST",
                data : formData,
                success: function(data)
                {
                    //data - response from server
                    if(data.code != 'OK'){
                        layer.open({
                            content:data.msg
                            ,skin: 'msg'
                            ,time:3 //2秒后自动关闭
                        });
                    }else {
                        layer.open({
                            content:'发送成功'
                            ,skin: 'msg'
                            ,time:3 //2秒后自动关闭
                        });
                    }
                },
                error: function (jqXHR)
                {
                    layer.open({
                        content:'发送失败'
                        ,skin: 'msg'
                        ,time:3 //2秒后自动关闭
                    });
                }
            });
            var obj = $("#verification_code");
            settime(obj);
        }else{
            //信息框
            //提示
            layer.open({
                content:'请输入正确的手机号请输入正确的手机号'
                ,skin: '请输入正确的手机号请输入正确的手机号'
                ,time:3 //2秒后自动关闭
            });
        }

    }
    $(function(){
        $('#sublimit').on('click',function(){
            var  res = searchSub();
            var invitationCode=$("input[name='invitationCode']").val();
            if(res =='ok'){
               var companyType =  $("input[name='companyType']:checked").val();
                if(companyType ==1 ){
                    window.location.href='personal.html?invitationCode='+invitationCode
                }
                if(companyType == 2){
                    window.location.href='company.html?invitationCode='+invitationCode
                }
            }else{
                //信息框
                //提示
                layer.open({
                    content:res
                    ,skin: 'msg'
                    ,time:3 //2秒后自动关闭
                });
            }
        });
    });
</script>
</body>
</html>